﻿@addTagHelper "*, TestAssembly"
@{
    var people = new Person[]
    {
        new Person() { Name = "Taylor", Age = 95, },
    };

    void PrintName(Person person)
    {
        <div>@person.Name</div>
    }
}

@{ PrintName(people[0]); }
@{ await AnnounceBirthday(people[0]); }

@functions {
    Task AnnounceBirthday(Person person)
    {
        var formatted = $"Mr. {person.Name}";
        <div>
            <h3>Happy birthday @(formatted)!</h3>
        </div>

        <ul>
        @for (var i = 0; i < person.Age / 10; i++)
        {
            <li>@(i) Happy birthday!</li>
        }
        </ul>

        if (person.Age < 20)
        {
            return Task.CompletedTask;
        }

        <h4>Secret message</h4>
        return Task.CompletedTask;
    }


    class Person
    {
        public string Name { get; set; }
        public int Age { get; set; }
    }
}